import os
from google.appengine.ext.webapp import template
from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from api_key import handler


class MainPage(webapp.RequestHandler):

    def get(self):
        #self.response.headers['Content-Type'] = 'text/plain'
        #self.response.out.write('Hello, bm128 World!')
        template_values = {
            'appName' : 'bm128'
        }
        
        path = os.path.join(os.path.dirname(__file__), 'index.html')
        self.response.out.write(template.render(path, template_values))


application = webapp.WSGIApplication([
        ('/', MainPage),
        ('/api_key/add', handler.AddApiKey),
        ('/api_key/list', handler.ListApiKey),
        ('/api_key/edit', handler.EditApiKey),
        ('/api_key/delete', handler.DeleteApiKey),
], debug=True)


def main():
    run_wsgi_app(application)

if __name__ == "__main__":
    main()